package com.qiangqiang.dao.concrete;

import com.qiangqiang.adapter.SqlAdapter;
import com.qiangqiang.entity.Student;

/**
 * Created by q on 2018/3/25.
 */
public class StudentDao {

    public void insert(Student student) {
        StringBuffer sb = new StringBuffer("insert into student values(");
        sb.append("'" + student.getStuId() + "'" + ",").append("'" + student.getName() + "'" + ",").append(student.getTotCret() + ")");
        new SqlAdapter().execute(sb.toString());
    }

    public void updateCredits(String stuId, int credits) {
        StringBuffer sb = new StringBuffer("update student set tot_cret=").append(credits).
                append(" where stu_id=").append("'"+stuId+"'");
        new SqlAdapter().execute(sb.toString());
    }

}
